<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui">

<h:panelGroup layout="block" styleClass="cabecalho">
		
	<h:panelGroup layout="block" styleClass="container">
		
		<h:panelGroup layout="block" styleClass="left">
					
			<h:graphicImage library="images/sistema" name="logo-mini.png"
				rendered="#{!SessaoBean.autenticado}"
				styleClass="logoMini" />
						
			<h:form id="logoForm" prependId="false" rendered="#{SessaoBean.autenticado}">						
					
				<h:commandLink action="#{SessaoBean.navegarInicio()}">
					<h:graphicImage library="images/sistema" name="logo-mini.png"
						title="#{locale['sistema.voltarInicio']}"
						styleClass="logoMini" />
				</h:commandLink>
								
			</h:form>			
						
		</h:panelGroup>
				
		<h:panelGroup layout="block" 
			styleClass="right cabecalhoInformacao" 
			rendered="#{!SessaoBean.autenticado}">
				
			<p:commandButton id="loginBtn"
				style="margin-top: 3px;"
				styleClass="ui-priority-primary"
				value="#{locale['sistema.botao.autenticar']}"
				type="button"
				onclick="loginDlg.show();" />
				
		</h:panelGroup>
				
		<h:panelGroup layout="block" 
			styleClass="right cabecalhoInformacao" 
			rendered="#{SessaoBean.autenticado}">
			
			<h:panelGrid id="cabecalho" columns="2">
						
				<h:panelGrid columns="1" 
					styleClass="info-nome-funcao">
					
					<h:outputText value="#{SessaoBean.usuarioAutenticado.nome}" />
									
				</h:panelGrid>
								
				<p:commandLink id="maisInfoLnk">
					 <p:graphicImage 
					 	value="resources/images/usuarios/#{SessaoBean.usuarioAutenticado.avatar}" 
					 	width="26" height="26" />
				</p:commandLink>
						
			</h:panelGrid>
			
		</h:panelGroup>
		
	</h:panelGroup>	
	
</h:panelGroup>

<h:panelGroup layout="block" styleClass="menuContainer">
	<h:panelGroup layout="block" styleClass="menu">
	<h:form>
		<ul>
			<li><h:outputLink value="/jPressWEB/inicio"><h:outputText value="Inicio" /></h:outputLink></li>
			<li><h:outputLink value="/jPressWEB/paginas/contato.jsf"><h:outputText value="Contato" /></h:outputLink></li>
			<li><h:commandLink value="Quem Somos" action="menu" /></li>
		</ul>
	</h:form>
	</h:panelGroup>
</h:panelGroup>

<p:dialog id="loginDialogo"
	widgetVar="loginDlg"
	resizable="false" closable="false" draggable="false"
	showEffect="slide" hideEffect="slide"
	modal="true">
			
	<f:facet name="header">
		<h:outputText value="#{locale['login.titulo']}" />
	</f:facet>
			
	<h:form id="loginForm">
	
		<h:panelGroup layout="block" styleClass="loginMessages">
			<p:messages id="loginMessages" />
		</h:panelGroup>
			
		<h:panelGrid columns="2">
			
			<p:outputLabel id="emailLoginLbl"
				for="emailLogin" value="#{locale['login.label.email']}" />
			<p:inputText id="emailLogin"
				required="true"
				maxlength="100"
				size="37"
				value="#{SessaoBean.email}" />
					
			<p:outputLabel id="senhaLoginLbl" 
				for="senhaLogin" value="#{locale['login.label.senha']}" />
			<p:password id="senhaLogin"
				required="true"
				inline="true"
				maxlength="32"
				size="37"
				value="#{SessaoBean.senha}">
				<f:validateLength minimum="8" maximum="32" />
			</p:password>
					
		</h:panelGrid>
			
		<p:spacer height="10" />
			
		<h:panelGroup layout="block" style="text-align: right; margin-top: 10px;">
				
			<p:commandButton id="autenticarBtn"
				styleClass="ui-priority-primary"
				update="loginForm"
				value="#{locale['login.botao.autenticar']}"
				action="#{SessaoBean.autenticar()}" />
			
			<p:commandButton id="cancelarAutenticacaoBtn"
				update="loginForm"
				value="#{locale['login.botao.cancelar']}"
				action="#{SessaoBean.cancelarAutenticacao()}"
				immediate="true" />
									
		</h:panelGroup>
		
	</h:form>
			
</p:dialog>

<p:overlayPanel for=":maisInfoLnk" my="left top"
	showEffect="slide" hideEffect="slide"
	appendToBody="true" widgetVar="maisInfo">
				
	<h:outputText value="#{SessaoBean.usuarioAutenticado.email}" />
		
	<h:form id="maisInfoForm">
		
		<p:menu styleClass="maisInfoMenu" autoDisplay="false">
			
			<p:menuitem value="Painel de Usuario" 
				icon="ui-icon-person" styleClass="maisInfoMenuItem"
				ajax="false"
				action="#{PaginaInicialBean.acessarPaineldeUsuario()}" />
				
			<p:menuitem value="#{locale['menuUsuario.botao.painelControle']}"
				rendered="#{SessaoBean.usuarioAutenticado.admin}" 
				icon="ui-icon-gear" styleClass="maisInfoMenuItem"
				ajax="false"
				action="#{PaginaInicialBean.acessarPaineldeControle()}" />
								
			<p:menuitem value="#{locale['sistema.botao.sair']}" 
				icon="ui-icon-power" styleClass="maisInfoMenuItem"
				onclick="maisInfo.hide();"
				ajax="false"
				action="#{SessaoBean.sair()}" />
				
			
				
		</p:menu>
			
	</h:form>
					
</p:overlayPanel>

</ui:composition>